package com.whiteape.book.presenter;

import com.whiteape.book.contract.WebSourceContract;
import com.whiteape.book.core.manager.SiteSourceManager;
import com.whiteape.book.model.dto.CollectionMediaBean;
import com.whiteape.book.ui.base.RxPresenter;
import com.whiteape.book.utils.RxUtils;

import java.util.List;

public class WebSourcePresenter extends RxPresenter<WebSourceContract.View> implements WebSourceContract.Presenter {
    @Override
    public void refreshWebSource() {

        addDisposable(SiteSourceManager.getInstance().getSiteSourceAllInRx()
                .compose(RxUtils::toSimpleSingle)
                .subscribe(siteSourceBeanList -> mView.finishRefresh(siteSourceBeanList),
                        throwable -> mView.showError()));
//        mView.finishRefresh(SiteSourceManager.getInstance().getSiteSourceAll());

    }

    @Override
    public void updateCollectionMedia(List<CollectionMediaBean> collectionMediaBeans) {

    }
}
